<?php

namespace app\api\controller;
use app\BaseController;
use app\api\model\Role as RoleModel;

class Role extends Base {

  public function __construct() {
    $this->model = new RoleModel();
  }

  public function create() {
    $data = input('post.');
    $data['routes'] = input('post.routes', '', null);
    if(!empty($data['id'])) {
      $this->model->update($data);
    } else {
      $this->model->save($data);
    }
    return success();
  }

}